<?php

use yii\db\Migration;

class m180607_072723_createcustomer_upgrade_rule extends Migration
{
    public function safeUp()
    {
            $this->createTable('{{%customer_upgrade_rule}}',[
                'id' => $this->primaryKey()->notNull()->comment('自增id'),
                'type_id'=>$this->integer()->notNull()->defaultValue(0)->comment('升级类型id'),
                'grade_id'=>$this->smallInteger()->notNull()->defaultValue(0)->comment('等级id'),
                'site_id'=>$this->integer()->defaultValue(0)->comment('分店id'),
                'money'=>$this->decimal(10,2)->defaultValue(0)->comment('充值/购买金额'),
                'status'=>$this->smallInteger(2)->defaultValue(1)->comment('状态 1 启用 2 禁用'),
                'admin_id'=>$this->integer()->defaultValue(0)->comment('操作人id'),
                'expiry_date'=>$this->double(10,1)->defaultValue(0)->comment('有效期（单位：年）'),
                'created_at' => $this->integer()->defaultValue(0)->comment('下单时间'),
            ]);
    }

    public function safeDown()
    {
        $this->dropTable('{{%customer_upgrade_rule}}');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180607_072723_createcustomer_upgrade_rule cannot be reverted.\n";

        return false;
    }
    */
}
